import request from '@/utils/request'
// 统一请求体
const creatRequestView = () => {
  return {
    reqInMsgHeader: {
      ReqModles: 'xxx'// 请求模式-备用
    },
    main: {}
  }
}

const defaultRequestView = creatRequestView()// 获得初始化的请求体对象
const updateDefaultRequestView = { // 创建更新默认请求实体对象方法
  update: (obj) => {
    Object.assign(defaultRequestView.main, obj) // 用法：assign(target,obj)
  },
  updateRequestHeader: (obj) => {
    Object.assign(defaultRequestView.reqInMsgHeader, obj) // 用法：assign(target,obj)
  }
}
// 分页查询
export function getAllExpanseInfoPage(queryparams) {
  updateDefaultRequestView.update(queryparams)
  return request({
    url: '/expanseinfo/getAllExpanseInfoPageFilter',
    method: 'post',
    data: defaultRequestView
  })
}
// 查询所有
export function getAllExpanseInfoList() {
  return request({
    url: '/expanseinfo/getAllExpanseInfo',
    method: 'get'
  })
}
// 查询住户的一个或多个费用项目支付信息
export function getOneOrMoreExpansePayInfoList(householdCode) {
  updateDefaultRequestView.update({ householdCode: householdCode })
  return request({
    url: '/expanseinfo/getAllExpanseInfoByHousehold',
    method: 'post',
    data: defaultRequestView
  })
}
// 增加
export function addOneExpanseInfo(obj) {
  updateDefaultRequestView.update({
    householdInfo: obj.datasource, houseNumber: obj.houseNumber, houseArea: obj.houseArea, heatingArea: obj.heatingArea, expanseIdList: obj.expanseIdList
  })
  return request({
    url: '/expanseinfo/addOneExpanseInfo',
    method: 'post',
    data: defaultRequestView
  })
}
// 修改
export function modifyOneExpanseInfo(obj) {
  updateDefaultRequestView.update({ villageInfo: obj })
  return request({
    url: '/expanseinfo/modifyOneExpanseInfo',
    method: 'post',
    data: defaultRequestView
  })
}
// 删除
export function dropBatchExpanseInfo(array) {
  updateDefaultRequestView.update({ villageInfoIdList: array })
  return request({
    url: '/expanseinfo/dropBatchExpanseInfo',
    method: 'post',
    data: defaultRequestView
  })
}
